package com.ztk.trancation.service;

import com.ztk.trancation.mapper.TranscationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TestRequireNewService {
    @Autowired
    private TranscationMapper transcationMapper;

    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
    public void requireNewUpdate(String date, int count) {
        System.out.println("开始更新");
        transcationMapper.update(date, count);
        System.out.println("更新结束");
    }

}
